package cn.yshujia.domain.entity;

import cn.yshujia.handler.EncryptionHandler;
import cn.yshujia.handler.PrefixHandler;
import cn.yshujia.handler.SensitiveHandler;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author YShuJia
 * @create 2024/4/23
 * @description 实体
 */

@Data
@TableName (value = "t_tree_hole", autoResultMap = true)
@Schema (name = "TreeHole", description = "树洞（留言）")
public class TreeHole implements Serializable {
	@Serial
	private static final long serialVersionUID = 1L;
	
	@Schema (description = "自增主键")
	@TableId (value = "id", type = IdType.AUTO)
	private Long id;
	
	@Schema (description = "发送人ip地址")
	@TableField (value = "ip", typeHandler = EncryptionHandler.class)
	private String ip;
	
	@Schema (description = "随机头像")
	@TableField (value = "avatar", typeHandler = PrefixHandler.class)
	private String avatar;
	
	@Schema (description = "留言内容")
	@TableField (value = "content", typeHandler = SensitiveHandler.class)
	private String content;
	
	@Schema (description = "创建时间")
	@TableField (value = "create_time", fill = FieldFill.INSERT)
	@JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date createTime;
}